﻿<%@ WebHandler Language="C#" Class="list" %>
using Models;
using System;
using System.Web;
using Newtonsoft.Json;
using System.Linq;

public class list : IHttpHandler {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";

        //string query = HttpContext.Current.Request.Params["page"];



        //if (string.IsNullOrEmpty(query))
        //{
        //    HttpContext.Current.Response.Write("parameter error");
        //    return;
        //}


        var code = "1";
        var msg = "商品列表";
        var time = DateTime.Now;

        using (Entities bll = new Entities())
        {
            var Bpl = bll.S_Goods.Where(p => p.IsLock != true).Select(x => new
            {
                x.GID,
                x.GName,
                x.SCCLASSID,
                x.GImg,
                x.GPriceYJ,
                x.GSales,
                x.GSort

            });//全部.ToList();

            context.Response.Write(JsonConvert.SerializeObject(new { code,msg,time,Bpl}));

        }

        HttpContext.Current.Response.End();
        //context.Response.Write("Hello World");


    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}